# Generated by Django 4.1.7 on 2023-03-09 18:07

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('app_users', '0001_initial'),
        ('app_megano', '0002_alter_category_options_alter_productimages_options_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='DeliveryType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, null=True, verbose_name='Тип доставки')),
                ('description', models.TextField(blank=True, null=True, verbose_name='Описание типа доставки')),
            ],
            options={
                'verbose_name': 'Тип доставки',
                'verbose_name_plural': 'Типы доставки',
            },
        ),
        migrations.CreateModel(
            name='Orders',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('createdAt', models.DateTimeField(auto_now_add=True, verbose_name='Дата оформления заказа')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='Дата обновления заказа')),
                ('totalCost', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Сумма заказа')),
                ('address', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='app_users.address')),
                ('city', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='app_users.cities')),
                ('deliveryType', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='app_orders.deliverytype')),
            ],
            options={
                'verbose_name': 'Заказ',
                'verbose_name_plural': 'Заказы',
                'ordering': ('-createdAt',),
            },
        ),
        migrations.CreateModel(
            name='PaymentType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, null=True, verbose_name='Тип оплаты')),
                ('description', models.TextField(blank=True, null=True, verbose_name='Описание типа оплаты')),
            ],
            options={
                'verbose_name': 'Тип оплаты',
                'verbose_name_plural': 'Типы оплаты',
            },
        ),
        migrations.CreateModel(
            name='Status',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, null=True, verbose_name='Статус')),
                ('description', models.TextField(blank=True, null=True, verbose_name='Описание статуса')),
            ],
            options={
                'verbose_name': 'Статус',
                'verbose_name_plural': 'Статусы',
            },
        ),
        migrations.CreateModel(
            name='ProductInOrder',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('price', models.DecimalField(decimal_places=2, default=0, max_digits=9, verbose_name='Стоимость единицы товара')),
                ('count', models.PositiveSmallIntegerField(default=1, verbose_name='Количество товара в заказе')),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='app_orders.orders')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='app_megano.products')),
            ],
            options={
                'verbose_name': 'Товар в заказе',
                'verbose_name_plural': 'Товары в заказе',
            },
        ),
        migrations.AddField(
            model_name='orders',
            name='paymentType',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='app_orders.paymenttype'),
        ),
        migrations.AddField(
            model_name='orders',
            name='status',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='app_orders.status'),
        ),
        migrations.AddField(
            model_name='orders',
            name='user_profile',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='app_users.userprofile'),
        ),
    ]
